Micron Document
ZgRNS Git Node

Node / mirrors / rns-page-node / files / docs / en / configuration.md

Displaying Rendered • View rawDownload

docs/en/configuration.md HEAD (93ad7c85) Text, 3.15 KB

Configuration

Values are resolved in this order:

1. Command line flag.
2. Environment variable.
3. Config file key.
4. Built-in default.

A value passed on the command line beats the same value from the config file. A config file value beats the default.

Config file format

The file is plain text. Each line is a T383838key=value pair. Lines starting with T383838# are comments. Empty lines are ignored.

A minimal config file:

T282828

node-name=My Page Node

pages-dir=./pages
files-dir=./files
media-dir=./media
identity-dir=./node-config

announce-interval=360

page-refresh-interval=300

file-refresh-interval=300

log-level=INFO

You can find a working example in the repository at T383838config.example.

CLI flags and environment variables

┌───────────────────────┬──────────────────────┬─────────────────────────┬───────────────────┬─────┐
│ Config key │ CLI flag │ Environment variable │ Default │ No… │
├───────────────────────┼──────────────────────┼─────────────────────────┼───────────────────┼─────┤
│ T383838reticulum-config │ T383838-c, T383838--config │ none │ none │ Pa… │
│ T383838pages-dir │ T383838-p, T383838--pages-dir │ none │ T383838./pages │ Di… │
│ T383838files-dir │ T383838-f, T383838--files-dir │ none │ T383838./files │ Di… │
│ T383838media-dir │ T383838-m, T383838--media-dir │ T383838RNS_PAGE_NODE_MEDIA_DIR │ same as pages-dir │ We… │
│ T383838node-name │ T383838-n, T383838--node-name │ none │ none │ Hu… │
│ T383838announce-interval │ T383838-a, T383838--announce-inte… │ none │ T383838360 │ Mi… │
│ T383838identity-dir │ T383838-i, T383838--identity-dir │ none │ T383838./node-config │ Wh… │
│ T383838page-refresh-interval │ T383838--page-refresh-inte… │ none │ T3838380 │ Se… │
│ T383838file-refresh-interval │ T383838--file-refresh-inte… │ none │ T3838380 │ Se… │
│ T383838log-level │ T383838-l, T383838--log-level │ none │ T383838INFO │ T383838DE… │
└───────────────────────┴──────────────────────┴─────────────────────────┴───────────────────┴─────┘

Passing a config file on the command line

The first positional argument is the path to a config file.

T282828
rns-page-node myconfig.conf

You can still override a single value with a flag:

T282828
rns-page-node myconfig.conf --log-level DEBUG

Environment variables

The only environment variable with a special name is T383838RNS_PAGE_NODE_MEDIA_DIR. It sets the media directory if no T383838--media-dir flag is given. It is checked before the config file.

Other settings do not use a prefix. They are read as plain keys, but the CLI flags are the usual way to set them.

Multiple ways to set the same thing

This command sets the media directory with a flag:

T282828
rns-page-node -m ./media

This command sets it through the config file:

T282828
media-dir=./media

And this sets it through the environment:

T282828
Tffa657export Te6edf3RNS_PAGE_NODE_MEDIA_DIRTff7b72=./media
rns-page-node


Only the first source in the precedence order is used for each setting.

Served by rngit 1.5.2 - Generated in 0.04s